home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX Base Documentation 1998 November
/
IRIX 6.5.2 Base Documentation November 1998.img
/
usr
/
share
/
catman
/
p_man
/
cat3
/
SCGetEventFD.z
/
SCGetEventFD
Wrap
Text File
|
1998-10-30
|
7KB
|
133 lines
SSSSCCCCGGGGEEEETTTTEEEEVVVVEEEENNNNTTTT((((3333)))) IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo SSSSCCCCGGGGEEEETTTTEEEEVVVVEEEENNNNTTTT((((3333))))
NNNNAAAAMMMMEEEE
SCGetEventFD, SCEventPending, SCGetEvent - Receiving events from scanner
drivers
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
####iiiinnnncccclllluuuuddddeeee <<<<ssssttttddddiiiioooo....hhhh>>>>
####iiiinnnncccclllluuuuddddeeee <<<<ssssccccaaaannnnnnnneeeerrrr....hhhh>>>>
iiiinnnntttt SSSSCCCCGGGGeeeettttEEEEvvvveeeennnnttttFFFFDDDD((((SSSSCCCCAAAANNNNNNNNEEEERRRR ****ssss))));;;;
iiiinnnntttt SSSSCCCCEEEEvvvveeeennnnttttPPPPeeeennnnddddiiiinnnngggg((((SSSSCCCCAAAANNNNNNNNEEEERRRR ****ssss))));;;;
iiiinnnntttt SSSSCCCCGGGGeeeettttEEEEvvvveeeennnntttt((((SSSSCCCCAAAANNNNNNNNEEEERRRR ****ssss,,,, SSSSCCCCEEEEVVVVEEEENNNNTTTT ****eeeevvvveeeennnntttt))));;;;
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
Scanner applications need to be prepared to receive events from scanner
drivers. Events are used to inform the scanner application that it must
reread configuration information about the scanner; this is the
information obtained by calls to _S_C_G_e_t_P_a_g_e_S_i_z_e(3), _S_C_G_e_t_M_i_n_M_a_x_R_e_s(3),
_S_C_G_e_t_S_c_a_n_n_e_r_R_e_s(3), _S_C_G_e_t_D_a_t_a_T_y_p_e_s(3), and _S_C_F_e_e_d_e_r_G_e_t_F_l_a_g_s(3).
For example, some scanners with transparency units have different scan
areas depending on whether transparent or reflective media is being
scanned. In this scenario, the user would indicate to the driver which
media was present using the scanner specific options program, and if this
changed the effective scanning area the driver would then inform the
application of the change by sending an event.
_S_C_G_e_t_E_v_e_n_t_F_D returns a file descriptor that can be passed to the
_s_e_l_e_c_t(2) system call; when _s_e_l_e_c_t indicates that the file descriptor is
ready for reading then there is an event pending. _S_C_E_v_e_n_t_P_e_n_d_i_n_g returns
1 if an event is currently pending or 0 otherwise. Scanner applications
should either pass the return value of _S_C_G_e_t_E_v_e_n_t_F_D to the _s_e_l_e_c_t system
call, or arrange to periodically call _S_C_E_v_e_n_t_P_e_n_d_i_n_g.
_S_C_G_e_t_E_v_e_n_t retrieves a pending event. _e_v_e_n_t is a pointer to an EEEEVVVVEEEENNNNTTTT
structure, which is defined in /_u_s_r/_i_n_c_l_u_d_e/_s_c_a_n_n_e_r_s._h as follows:
typedef struct tag_infoChange {
unsigned int pageSizeChanged : 1;
unsigned int resolutionChanged : 1;
unsigned int dataTypesChanged : 1;
unsigned int feederFlagsChanged : 1;
} SCINFOCHANGE;
#define SCEVENT_INFOCHANGE 1
typedef struct tag_scevent {
unsigned int eventType;
union {
SCINFOCHANGE infoChange;
} event;
PPPPaaaaggggeeee 1111
SSSSCCCCGGGGEEEETTTTEEEEVVVVEEEENNNNTTTT((((3333)))) IIIImmmmpppprrrreeeessssssssaaaarrrriiiioooo SSSSCCCCGGGGEEEETTTTEEEEVVVVEEEENNNNTTTT((((3333))))
} SCEVENT;
After calling _S_C_G_e_t_E_v_e_n_t, _e_v_e_n_t->_e_v_e_n_t_T_y_p_e should be compared to
SSSSCCCCEEEEVVVVEEEENNNNTTTT____IIIINNNNFFFFOOOOCCCCHHHHAAAANNNNGGGGEEEE before assuming that _e_v_e_n_t->_e_v_e_n_t._i_n_f_o_C_h_a_n_g_e is valid;
future versions of Impressario may expand upon the event mechanism.
If _e_v_e_n_t->_e_v_e_n_t._i_n_f_o_C_h_a_n_g_e._p_a_g_e_S_i_z_e_C_h_a_n_g_e_d is 1, then the application
should call _S_C_G_e_t_P_a_g_e_S_i_z_e to query the changed scanning area; if _e_v_e_n_t-
>_e_v_e_n_t._i_n_f_o_C_h_a_n_g_e._r_e_s_o_l_u_t_i_o_n_C_h_a_n_g_e_d is 1, then the application should
call _S_C_G_e_t_M_i_n_M_a_x_R_e_s and _S_C_G_e_t_S_c_a_n_n_e_r_R_e_s to query the changed resolutions;
if _e_v_e_n_t->_e_v_e_n_t._i_n_f_o_C_h_a_n_g_e._d_a_t_a_T_y_p_e_s_C_h_a_n_g_e_d is 1, then the application
should call _S_C_G_e_t_D_a_t_a_T_y_p_e_s to query the changed data types; and if
_e_v_e_n_t->_e_v_e_n_t._i_n_f_o_C_h_a_n_g_e._f_e_e_d_e_r_F_l_a_g_s_C_h_a_n_g_e_d is 1, then the application
should call _S_C_F_e_e_d_e_r_G_e_t_F_l_a_g_s to query the changed feeder flags.
For all functions, _s is a SSSSCCCCAAAANNNNNNNNEEEERRRR pointer returned by a call to
_S_C_O_p_e_n(3), _S_C_O_p_e_n_F_i_l_e(3), or _S_C_O_p_e_n_S_c_r_e_e_n(3).
RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE
_S_C_G_e_t_E_v_e_n_t_F_D returns a file descriptor that should be passed to _s_e_l_e_c_t;
when _s_e_l_e_c_t indicates that the file descriptor is ready for reading then
there is an event pending.
_S_C_E_v_e_n_t_P_e_n_d_i_n_g returns 1 if an event is pending, 0 if no events are
pending, and -1 if an error occurs.
_S_C_G_e_t_E_v_e_n_t returns 0 if an event was successfully retrieved and -1 if an
error occurred.
In the event of an error, _S_C_E_v_e_n_t_P_e_n_d_i_n_g and _S_C_G_e_t_E_v_e_n_t will set _S_C_e_r_r_n_o
to indicate the cause of the error.
EEEEXXXXEEEECCCCUUUUTTTTIIIIOOOONNNN EEEERRRRRRRROOOORRRR CCCCOOOODDDDEEEESSSS
SCENOEVENTPENDING No event pending
SCECOMM Error communicating with scanner driver
In addition, _S_C_E_v_e_n_t_P_e_n_d_i_n_g and _S_C_G_e_t_E_v_e_n_t may fail as the result of a
failed system call, in which case _S_C_e_r_r_n_o will be set to a value from
/_u_s_r/_i_n_c_l_u_d_e/_s_y_s/_e_r_r_n_o._h.
SSSSEEEEEEEE AAAALLLLSSSSOOOO
_l_i_b_s_c_a_n(3), _s_e_l_e_c_t(2).
PPPPaaaaggggeeee 2222